#include "hint_Dlg.h"
#include "ui_hint_Dlg.h"
#include <QDesktopWidget>

Hint_Dlg *Hint_Dlg::hint_instance = 0;
Hint_Dlg::Hint_Dlg(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::hint_Dlg)
{
    ui->setupUi(this);
    hint_initWidget();
}

Hint_Dlg::~Hint_Dlg()
{
    delete ui;
}

void Hint_Dlg::hint_initWidget()
{
    this->setAttribute(Qt::WA_TranslucentBackground);
    this->setWindowFlags(Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint);
    this->setModal(true);
    this->move((QApplication::desktop()->width()-this->width())/2,(QApplication::desktop()->height()-this->height())/2);
}

void Hint_Dlg::hint_setHintText(QString text)
{
//    ui->label_hint->adjustSize();
//    ui->label_hint->setGeometry(QRect(10, 10, this->width()-20, this->height()-20));
//    ui->label_hint->setWordWrap(true);
//    ui->label_hint->setAlignment(Qt::AlignCenter);
//    ui->label_hint->clear();
//    ui->label_hint->setText(text);
    ui->textEdit->setReadOnly(true);
 //   ui->textEdit->setEnabled(false);
    ui->textEdit->adjustSize();
    ui->textEdit->setGeometry(QRect(10, 10, this->width()-20, this->height()-20));
 //   ui->textEdit->setWordWrap(true);
    ui->textEdit->setAlignment(Qt::AlignCenter|Qt::AlignBottom|Qt::AlignHCenter );
    ui->textEdit->clear();
    ui->textEdit->setText(text);
    ui->Btn_OK->setFocus();
}


void Hint_Dlg::hint_setTitleText(QString str){
    ui->label_title->clear();
    ui->label_title->setText(str);
}
void Hint_Dlg::hint_setHintPixmap(QPixmap png){
    ui->label_pixmap->setPixmap(png);
}
void Hint_Dlg::on_Btn_OK_clicked()
{
    close();
//    if(ui->label_hint->text().contains("重启"))
//        emit hint_rebootNVR_signal();
}
